import { createRouter, createWebHistory } from 'vue-router'
import personRoutes from './modules/person.js'
import canteenRoutes from  './modules/canteen.js'
import hostelManage from "./modules/hostelManage.js"
import Person from '@/views/person/index.vue'
import {UserFilled} from "@element-plus/icons-vue";
const baseRoutes = [
    // {
    //     path: '',
    //     redirect: '/login'
    // },
    {
        path: '/',
        name: 'Login',
        component:() => import('@/views/login/index.vue')
    },
    {
        path: '/home',
        name: 'Home',
        component:() => import('@/views/home/index.vue')
    },
    {
        path: '/404',
        component: () => import('@/views/error/404.vue'),
        meta: { hidden: true }
    },
    {
        path: '/:pathMatch(.*)*',
        redirect: '/404',
        meta: { hidden: true }
    }
]

// const routes = [
    // {
    //     path: '/',
    //     redirect: '/login'
    // },
    // {
    //     path: '/login',
    //     name: 'Login',
    //     component:() => import('@/views/login/index.vue')
    // },
    // {
    //     path: '/home',
    //     name: 'Home',
    //     component:() => import('@/views/home/index.vue') },
    // {
    //     path: '/person',
    //     component:Person ,
    //     meta:{title:'人员管理',icon:UserFilled},
    //     children:[
    //         {
    //             path:'/person/insider',
    //             name:'PersonInsider',
    //             component:() => import('@/views/person/Insider/index.vue'),
    //             meta:{title:'内部人员',icon:UserFilled}
    //         },
    //         {
    //             path:'/person/outsiders',
    //             name:'PersonOutsiders',
    //             component:() => import('@/views/person/outsiders/index.vue'),
    //             meta:{title:'外部人员',icon:UserFilled}
    //         },
    //     ]
    //
    // },

// ]
const router = createRouter({
    history: createWebHistory(import.meta.env.BASE_URL),
    routes: [
        ...baseRoutes,
        ...personRoutes,
        ...canteenRoutes,
        ...hostelManage
        // 其他模块路由...
    ]
})
// 路由守卫等全局配置
router.beforeEach((to, from, next) => {
    // 全局前置守卫逻辑
    next()
})
export default router
